#!/bin/bash

# 克隆 backtrader 仓库
echo "正在克隆 backtrader 仓库..."
git clone https://gitee.com/yunjinqi/backtrader.git

# 检查是否克隆成功
if [ -d "./backtrader" ]; then
    echo "backtrader 仓库克隆成功。"
else
    echo "错误：backtrader 仓库克隆失败。"
    exit 1
fi

# 安装依赖
echo "正在安装依赖..."
pip install -U -r ./backtrader/requirements.txt

# 检查依赖是否安装成功
if [ $? -eq 0 ]; then
    echo "依赖安装成功。"
else
    echo "错误：依赖安装失败。"
    exit 1
fi

echo "backtrader 依赖包安装完成。"


# 安装backtrader

pip install -U ./backtrader


# 进行测试

pytest ./backtrader/tests -n 2

echo "backtrader测试完成"